package lab02.test11;

public class Square extends Rectangle {
    int side1;
    int side2;
    int proportion;
    int perimeter;
    double diagonal;

    @Override
    public int getPerimeter() {
        perimeter = (side1 + side2) * 2;
        return perimeter;
    }

    @Override
    public int getProportion() {
        return proportion = side1 * side2;
    }

    public double getDiagonal() {
        diagonal = Math.sqrt(side1 * side1 + side2 * side2);
        return diagonal;
    }

    @Override
    public void printMyWay() {

        System.out.println("边长1："+side1);
        System.out.println("边长2："+side2);
        System.out.println("周长："+getPerimeter());
        System.out.println("面积："+getProportion());
        System.out.println("对角线长："+getDiagonal());
    }
}
